call_hook: honor $STOP_ON_ERROR when an executed hook sets task_error#135
Open
peturingi wants to merge 1 commit intofaiproject:masterfrom
Open
call_hook: honor $STOP_ON_ERROR when an executed hook sets task_error#135peturingi wants to merge 1 commit intofaiproject:masterfrom
peturingi wants to merge 1 commit intofaiproject:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a failure mode where an executed (non-sourced) hook runs in a subshell and can’t reliably stop the parent FAI process when it triggers task_error above $STOP_ON_ERROR. The change makes the parent shell re-check the global task error state after an executed hook returns and stops the installation from the parent context when needed.
Changes:
- After running an executed hook (
$hook.$class), re-read$LOGDIR/task_error. - If the recorded error exceeds
$STOP_ON_ERROR, callstop_fai_installationfrom the parent shell.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1875230 to
b4676cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Debian bug: https://bugs.debian.org/1121552
A hook that runs as a separate process (not a
.shsourced hook) executes in a subshell. If it callstask_error CODE 1withCODE > $STOP_ON_ERROR,stop_fai_installationis invoked inside the subshell; in most environmentsdiethen only replaces the subshell (e.g.exec bash -iunder nfsroot) or only affects the subshell's state, so the parent FAI process continues running subsequent tasks.The fix re-reads
$LOGDIR/task_errorafter an executed hook returns and callsstop_fai_installationfrom the parent shell if the threshold has been crossed. Sourced.shhooks already run in the parent shell and need no change.